// 科室药品信息维护
import React from 'react';
import { Card, Row, Col, Form, DatePicker, Select, Button, Checkbox, Table, Switch, message, Pagination, Input } from 'antd';
import { $http } from 'containers/config/https';
import Moment from 'moment';
import store from 'store';
import './style/index.less';
import PublicModalTable from './../../common/PublicModalTable';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import CommonPagination from 'components/pagination/index';

const { Option } = Select;
const FormItem = Form.Item;
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 7 },
    wrapperCol: { span: 17 },
};
const formItemSpan = {    // label 和input宽度
    labelCol: { span: 16 },
    wrapperCol: { span: 8 },
};

const DrugMessageMaintain = Form.create()(
    class extends React.Component {
        constructor() {
            super();
            this.state = {
                userInfo: JSON.parse(window.sessionStorage.userData),
                data: [],
                queryCondition: {},
                SelectData: {},
                inOpLocDr: '',
                vendor: '',
                WaListData: [], //库存单数据
                pageSize: 10,
                page: 1,
                total: 0,
                stateID: '',
                modalData: [],
                ModalRowData: {}, // 弹框双击选中行数据
                stockID: '',
                SelectCode: [],//货位下拉的数据
                columns: [],
                ChineseEnglishSize: [],
                detailWidthTotal: '',
                resAvaQty: undefined
            };
            // 库存单的数据表头
            this.columns = [

                {
                    key: 2,
                    title: '代码',
                    dataIndex: 'stockCode',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 3,
                    title: '名称',
                    dataIndex: 'stockDesc',
                    align: "center",
                    width: '200px'
                },
                {
                    key: 4,
                    title: '规格',
                    dataIndex: 'stockSpec',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 5,
                    title: '基本单位',
                    dataIndex: 'baseUnitDesc',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 6,
                    title: '包装单位',
                    dataIndex: 'purUnitDesc',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 7,
                    title: '库存上限',
                    dataIndex: 'maxQty',
                    align: "center",
                    width: '100px',
                    render: (text, record, index) => {
                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'maxQty', record.stkLocID)} />)
                    }
                },
                {
                    key: 8,
                    title: '库存下限',
                    dataIndex: 'minQty',
                    align: "center",
                    width: '100px',
                    render: (text, record, index) => {
                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'minQty', record.stkLocID)} />)
                    }
                },
                {
                    key: 9,
                    title: '库存',
                    dataIndex: 'qty',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 10,
                    title: '可用库存',
                    dataIndex: 'avaQty',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 11,
                    title: '标准库存',
                    dataIndex: 'repLevQty',
                    align: "center",
                    width: '100px',
                    render: (text, record, index) => {
                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'repLevQty', record.stkLocID)} />)
                    }
                },
                {
                    key: 12,
                    title: '补货标准',
                    dataIndex: 'remark',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 1,
                    title: '货位',
                    dataIndex: 'stockBin',
                    align: "center",
                    width: '200px',
                    render: (text, record, index) => {
                        return (<Select mode="multiple" style={{ width: '100%' }} value={text} onChange={(e) => this.handleFieldSelect(e, 'stockBin', record.stkLocID)}>
                            {this.state.SelectCode.length > 0 && this.state.SelectCode.map((item, i) => {
                                return <Option value={item.stkBinID + ''} key={i}>{item.stkBinDesc}</Option>
                            })}
                        </Select>
                        )
                    }
                },
                {
                    key: 13,
                    title: '管制分类',
                    dataIndex: 'remark',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 14,
                    title: '加锁标志',
                    dataIndex: 'lockFlag',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 15,
                    title: '发药机标志',
                    dataIndex: 'sendMacFlag',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 16,
                    title: '不可用',
                    dataIndex: 'notUseFlag',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 17,
                    title: '更新人',
                    dataIndex: 'remark',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 18,
                    title: '更新日期',
                    dataIndex: 'remark',
                    align: "center",
                    width: '100px'
                },
                {
                    key: 19,
                    title: '更新时间',
                    dataIndex: 'remark',
                    align: "center",
                    width: '100px'
                },
            ];
            this.modalColumns = [
                {
                    key: 1,
                    title: this.state.userInfo.language == 'EN' ? 'Inventory item code' : '库存项代码',
                    dataIndex: 'stockCode',
                    align: "center",
                    width: '22%'
                },
                {
                    key: 2,
                    title: this.state.userInfo.language == 'EN' ? 'Inventory item description' : '库存项描述',
                    dataIndex: 'stockDesc',
                    align: "center",
                    width: '24%',
                },
                {
                    key: 5,
                    title: this.state.userInfo.language == 'EN' ? 'Inventory classification' : '库存分类',
                    dataIndex: 'stkSubCatDesc',
                    align: "center",
                    width: '16%',
                },
                {
                    key: 3,
                    title: this.state.userInfo.language == 'EN' ? 'Packing specification' : '包装规格',
                    dataIndex: 'stockSpec',
                    align: "center",
                    width: '12%',
                },
                {
                    key: 6,
                    title: this.state.userInfo.language == 'EN' ? 'Basic unit' : '基本单位',
                    dataIndex: 'baseUnitDesc',
                    align: "center",
                    width: '12%',
                },
                {
                    key: 7,
                    title: this.state.userInfo.language == 'EN' ? 'Storage unit' : '入库单位',
                    dataIndex: 'purUnitDesc',
                    align: "center",
                }
            ]
        }

        componentDidMount() {
            // 初始化数据
            this.getTacitlyApproveData();
            this.onChangeSelect();
            this.getDetailTableColumns();
            let listData = document.querySelectorAll('.detailsHeight  .ant-table-body');
            if (listData.length > 0) {
                listData[0].style.height = store.getState().tableHeight.y + 10 + 'px';
            }
        }
        //组件权限编辑器
        onColumnRef = (ref) => {
            this.columnRef = ref;
        };
        // 获取明系列表头数据
        getDetailTableColumns = () => {
            let { userInfo } = this.state;
            let data = {
                params: [{
                    reactCode: ['DepartmentDrugInformationMaint'],
                    compontName: 'DepartmentDrugInformationMaint',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                            return {
                                ...item,
                                key: index + 1,
                                title: <div onDoubleClick={() => { this.columnRef.onOpenModel(); }}>{userInfo.language == 'EN' ? item.enDescripts : item.title}</div>,
                                render: (text, record) => {
                                    if (item.code == 'maxQty') {
                                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'maxQty', record.stkLocID)} />)
                                    } else if (item.code == 'minQty') {
                                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'minQty', record.stkLocID)} />)
                                    } else if (item.code == 'repLevQty') {
                                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'repLevQty', record.stkLocID)} />)
                                    } else if (item.code == 'resAvaQty') { // 最小可用在途数
                                        return (<Input min={0} style={{ width: '80%' }} type="number" value={text} onChange={(e) => this.handleFieldChange(e, 'resAvaQty', record.stkLocID)} />)
                                    } else if (item.code == 'stockBin') {
                                        return (<Select mode="multiple" style={{ width: '100%' }} value={text} onChange={(e) => this.handleFieldSelect(e, 'stockBin', record.stkLocID)}>
                                            {this.state.SelectCode.length > 0 && this.state.SelectCode.map((item, i) => {
                                                return <Option value={item.stkBinID + ''} key={i}>{item.stkBinDesc}</Option>
                                            })}
                                        </Select>
                                        )
                                    } else {
                                        return text;
                                    }
                                    // return (<span className={record.warnID == 1 && item.code == 'warnStatus' ? 'redColor' : record.warnID == 2 && item.code == 'warnStatus' ? 'cyanColor': ''}>{text}</span>)
                                }
                            }
                        }) : '';
                        let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                        this.setState({ columns: filterArr, detailWidthTotal: res.totalWidth, ChineseEnglishSize: userInfo.language == 'EN' ? res.result.language.EN : res.result.language.CN })
                    }
                }
            });
        };

        componentWillUnmount() {
            // 组件销毁前将静止让setState修改state的状态，防止内存泄漏
            this.setState = (state, callback) => { return; }
        }

        //获取操作行数据对象
        getRowByKey(key, newData) {
            const { WaListData } = this.state;
            return (newData || WaListData).filter(item => item.stkLocID === key)[0];
        }

        //文本框数据修改
        handleFieldChange = (e, fieldName, key) => {
            const { WaListData } = this.state;
            const newData = WaListData.map(item => ({ ...item }));
            const target = this.getRowByKey(key, newData);
            if (target) {
                target[fieldName] = e.target.value;
                this.setState({ WaListData: newData });
            }
        };

        handleFieldSelect = (e, fieldName, key) => {
            const { WaListData } = this.state;
            const newData = WaListData.map(item => ({ ...item }));
            const target = this.getRowByKey(key, newData);
            if (target) {
                target[fieldName] = e;
                this.setState({ WaListData: newData });
            }
        };
        //清空表格内容
        handleReset = () => {
            this.setState({ WaListData: [], total: 0, stockID: '' });
            this.onChangeSelect(this.state.userInfo.locID);
            this.props.form.resetFields();
        };


        onRef = (ref) => {
            this.child = ref;
        };


        // 获取界面默认值
        getTacitlyApproveData() {
            let data = {
                params: []
            };
            // 获取下拉数据
            $http.post('urlS', this, {
                code: "02020194",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({ SelectData: res }, () => {
                            this.dataQuery();
                        })
                    }
                }
            })
        }

        dataQuery = () => {
            this.setState({ page: 1 }, () => {
                this.getMessageMaintainList()
            })
        }

        // 获取库存单列表数据
        getMessageMaintainList = () => {
            let { ChineseEnglishSize } = this.state;
            this.setState({ loading: true })
            this.props.form.validateFields((error, value) => {
                let obj = JSON.parse(JSON.stringify(value));
                if (error == null) {
                    let data = {
                        params: [{
                            locID: obj.Loc ? obj.Loc : undefined,
                            stkCatID: obj.stkCat ? obj.stkCat : undefined,
                            stkTypeID: obj.stkType ? obj.stkType : undefined,
                            stockBin: obj.stkBin && obj.stkBin.length > 0 ? obj.stkBin : undefined,
                            incNotUseFlag: obj.incNotUseFlag ? obj.incNotUseFlag : false,
                            stockID: this.state.stockID ? this.state.stockID : undefined,
                            resAvaQtyFlag: obj && obj.resAvaQtyFlag ? "Y" : "N", // 仅小于最小可用在途数
                        }],
                        pagination: [
                            {
                                pageSize: this.state.pageSize,
                                currentPage: this.state.page,
                                sort: "ID",
                                dir: "asc",
                            }
                        ],
                    };
                    $http.post('urlS', this, {
                        code: "02020195",
                        data: data,
                        success: function (res) {
                            if (res.rows.length > 0) {
                                for (let i = 0; i < res.rows.length; i++) {
                                    res.rows[i].key = i;
                                }
                                this.setState({ WaListData: res.rows, total: res.total, loading: false });

                            } else {
                                this.setState({ WaListData: [], total: 0, page: 1 });
                                message.error(ChineseEnglishSize.DepartmentDrugInformationMaintnoData ? ChineseEnglishSize.DepartmentDrugInformationMaintnoData.descripts : "没数据");

                            }
                        },
                        error: function (err) {
                            message.error(err.errorMessage)
                        }
                    });
                }
            })
        };

        // 获取库存单列表数据
        saveMaintain = () => {
            let data = {
                params: this.state.WaListData ? this.state.WaListData : ''
            };
            $http.post('urlS', this, {
                code: "02020196",
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        message.success(res.errorMessage);
                        this.getMessageMaintainList();
                    }
                }
            });
        };

        // 页码改变的回调，参数是改变后的页码及每页条数 库存单
        onChange = (page, pageSize) => {
            this.setState({ page: page, pageSize: this.state.pageSize }, () => {
                // 重新调用查询方法
                this.getMessageMaintainList();
            });
        };

        onShowSizeChange = (current, size) => {
            this.setState({ page: current, pageSize: size }, () => {
                // 重新调用查询方法
                this.onChange(current, size);
            })
        };

        // 显示分页总条数
        showTotal(total) {
            return `共 ${total} 条`;
        };

        // 获取描述列表数据
        getModalListData(alias) {
            let data = {
                params: [
                    {
                        stockAlias: alias, // 库存项描述别名
                        frLocID: this.state.frLocDr ? this.state.frLocDr : undefined
                    }
                ]
            };
            $http.post('urlS', this, {
                code: "02020042",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        for (var i = 0; i < res.result.length; i++) {
                            res.result[i].key = i
                        }
                        this.setState({ modalData: res.result })
                    } else {
                        this.setState({ modalData: [] })
                    }
                }
            })
        }
        // 描述回车事件
        stockDescOnPressEnter = (e) => {
            let top = document.getElementById('stock-desc').getBoundingClientRect().top + 40 + 'px';
            let left = document.getElementById('stock-desc').getBoundingClientRect().left + 100 + 'px';
            this.setState({
                top: top,
                left: left
            });
            this.getModalListData(e.target.value);
            this.child.showModal();
        };

        // 当描述失去焦点的时候
        stastockDescOnBlure = (e) => {
            if (this.state.ModalRowData && (e.target.value !== this.state.ModalRowData.stockDesc)) {
                this.props.form.setFieldsValue({ stockDesc: undefined });
            }
        };

        // 操作弹框
        onClickRowPublic = (record) => {
            return {
                onDoubleClick: () => {
                    this.confirmSelection(record);
                }
            }
        };
        // 双击选中行数据的回调
        confirmSelection = (record) => {
            // this.resetFields();
            this.setState({ ModalRowData: record }, () => {
                this.setState({ stockID: record.stockID });
                this.props.form.setFieldsValue({ stockDesc: record.stockDesc });
                // 关闭弹窗
                this.child.handleCancel();
            })
        };

        onchangeStock = (val) => {
            if (!val.target.value) {
                this.setState({ stockID: '' });
            }
        };
        //货位下拉的数据
        onChangeSelect = (id) => {
            this.props.form.validateFields((error, value) => {
                let obj = JSON.parse(JSON.stringify(value));
                if (error == null) {
                    let data = {
                        params: [{
                            locID: id ? id : obj.Loc ? obj.Loc : undefined,
                        }],
                        pagination: [
                            {
                                pageSize: this.state.pageSize,
                                currentPage: this.state.page,
                                sort: "ID",
                                dir: "asc",
                            }
                        ],
                    };
                    $http.post('urlS', this, {
                        code: "02020199",
                        data: data,
                        success: function (res) {
                            if (res.errorCode == 0) {
                                for (let i = 0; i < res.rows.length; i++) {
                                    res.rows[i].key = i;
                                }
                                this.setState({ SelectCode: res.rows });

                            } else {
                                this.setState({ SelectCode: [] });

                            }
                        }
                    });
                }
            })
        }

        // 最小可用在途数
        handleResAvaQtyChange = e => {
            this.setState({ resAvaQty: e.target.value })
        }

        // 批量更新
        handleBatchUpdate = () => {
            let {resAvaQty} = this.state;
            let locID = this.props.form.getFieldValue("Loc");
            let data = {
                params: [{
                    resAvaQty,
                    locID
                }],
            };
            $http.post('urlS', this, {
                code: "02020366",
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        message.success(res.errorMessage);
                        this.setState({resAvaQty: undefined}, () => {
                            this.dataQuery();
                        })
                    }
                }
            });
        }

        render() {
            const { getFieldDecorator } = this.props.form;
            //库存科室列表
            let inOpLocDrSelect = [];
            let { ChineseEnglishSize, userInfo, columns, resAvaQty } = this.state;
            this.state.SelectData.loc && this.state.SelectData.loc.map((item, i) => {
                inOpLocDrSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });
            let param = {
                width: '600px',
                top: this.state.top,
                left: this.state.left,
                columns: this.modalColumns,
                data: this.state.modalData,
                isOnRow: true,
                TableClassName: 'tab-placeholder',
            };
            return (
                <div className="drugMessageMaintain">
                    <Row>
                        <Card
                            size="small"
                            title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.DepartmentDrugInformationMaintdeptDrugInfoMain ? ChineseEnglishSize.DepartmentDrugInformationMaintdeptDrugInfoMain.descripts : '科室药品信息维护'}</div>}
                        >
                            <Col span={18}>
                                <Form>
                                    <Row >
                                        <Col span={8}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.DepartmentDrugInformationMaintloc ? ChineseEnglishSize.DepartmentDrugInformationMaintloc.descripts : '科室'}>
                                                {getFieldDecorator('Loc', {
                                                    initialValue: this.state.userInfo.locID ? this.state.userInfo.locID : undefined,
                                                    rules: [{ required: ChineseEnglishSize.DepartmentDrugInformationMaintloc ? ChineseEnglishSize.DepartmentDrugInformationMaintloc.required == 'Y' ? true : false : false, message: ChineseEnglishSize.DepartmentDrugInformationMaintloc ? ChineseEnglishSize.DepartmentDrugInformationMaintloc.message : '科室不能为空' }]
                                                })(
                                                    <Select allowClear onSelect={this.onChangeSelect}>
                                                        {inOpLocDrSelect}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} id='stock-desc'>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.DepartmentDrugInformationMaintstockDesc ? ChineseEnglishSize.DepartmentDrugInformationMaintstockDesc.descripts : '药品名称'}>
                                                {getFieldDecorator('stockDesc', {
                                                    initialValue: undefined,
                                                })(
                                                    <Input placeholder={ChineseEnglishSize.DepartmentDrugInformationMaintcarriageSearch ? ChineseEnglishSize.DepartmentDrugInformationMaintcarriageSearch.descripts : '回车检索药品相关信息'} allowClear onPressEnter={this.stockDescOnPressEnter} onBlur={this.stastockDescOnBlure} onChange={this.onchangeStock} />
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.DepartmentDrugInformationMaintstkBin ? ChineseEnglishSize.DepartmentDrugInformationMaintstkBin.descripts : '货位'}>
                                                {getFieldDecorator('stkBin', {
                                                    initialValue: undefined,
                                                    rules: [{ required: ChineseEnglishSize.DepartmentDrugInformationMaintstkBin ? ChineseEnglishSize.DepartmentDrugInformationMaintstkBin.required == 'Y' ? true : false : false, message: ChineseEnglishSize.DepartmentDrugInformationMaintstkBin ? ChineseEnglishSize.DepartmentDrugInformationMaintstkBin.message : '货位不能为空' }]
                                                })(
                                                    <Select
                                                        mode="multiple"
                                                    >
                                                        {this.state.SelectCode.length > 0 && this.state.SelectCode.map((item, i) => {
                                                            return <Option value={item.stkBinID} key={i}>{item.stkBinDesc}</Option>
                                                        })}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={8}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.DepartmentDrugInformationMaintStkCat ? ChineseEnglishSize.DepartmentDrugInformationMaintStkCat.descripts : '库存大类'}>
                                                {getFieldDecorator('stkCat', {
                                                    initialValue: undefined,
                                                    rules: [{ required: ChineseEnglishSize.DepartmentDrugInformationMaintStkCat ? ChineseEnglishSize.DepartmentDrugInformationMaintStkCat.required == 'Y' ? true : false : false, message: ChineseEnglishSize.DepartmentDrugInformationMaintStkCat ? ChineseEnglishSize.DepartmentDrugInformationMaintStkCat.message : '库存大类不能为空' }]
                                                })(
                                                    <Select allowClear>
                                                        {this.state.SelectData.stkCat && this.state.SelectData.stkCat.map((item, i) => {
                                                            return <Option value={item.id} key={i}>{item.descripts}</Option>
                                                        })}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.DepartmentDrugInformationMaintstkType ? ChineseEnglishSize.DepartmentDrugInformationMaintstkType.descripts : '库存类型'}>
                                                {getFieldDecorator('stkType', {
                                                    initialValue: undefined,
                                                    rules: [{ required: ChineseEnglishSize.DepartmentDrugInformationMaintstkType ? ChineseEnglishSize.DepartmentDrugInformationMaintstkType.required == 'Y' ? true : false : false, message: ChineseEnglishSize.DepartmentDrugInformationMaintstkType ? ChineseEnglishSize.DepartmentDrugInformationMaintstkType.message : '库存类型不能为空' }]
                                                })(
                                                    <Select allowClear>
                                                        {this.state.SelectData.stkType && this.state.SelectData.stkType.map((item, i) => {
                                                            return <Option value={item.id} key={i}>{item.descripts}</Option>
                                                        })}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemSpan} label={ChineseEnglishSize.DepartmentDrugInformationMaintincNotUseFlag ? (ChineseEnglishSize.DepartmentDrugInformationMaintincNotUseFlag.descripts + "：") : '包含不可用：'}>
                                                {getFieldDecorator('incNotUseFlag', {
                                                    valuePropName: 'checked',
                                                    initialValue: false,
                                                    rules: [{ required: false }]
                                                })(
                                                    userInfo.language == 'EN' ? <Switch checkedChildren="Yes" unCheckedChildren="No" onChange={this.dataQuery} /> : <Switch checkedChildren="是" unCheckedChildren="否" onChange={this.dataQuery} />
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemSpan} label="仅小于最小可用在途数：">
                                                {getFieldDecorator('resAvaQtyFlag', {
                                                    valuePropName: 'checked',
                                                    initialValue: false,
                                                })(
                                                    userInfo.language == 'EN' ? <Switch checkedChildren="Yes" unCheckedChildren="No" onChange={this.dataQuery} /> : <Switch checkedChildren="是" unCheckedChildren="否" onChange={this.dataQuery} />
                                                )}
                                            </FormItem>
                                        </Col>
                                    </Row>
                                </Form>
                            </Col>
                            <Col span={6}>
                                <Row style={{ margin: '5px 0 18px' }} className="button">
                                    <Button style={{ marginLeft: '20px' }} onClick={this.dataQuery}>{ChineseEnglishSize.DepartmentDrugInformationMaintsearch ? ChineseEnglishSize.DepartmentDrugInformationMaintsearch.descripts : '查询'}</Button>
                                    <Button type="primary" style={{ margin: '0 25px' }} onClick={this.handleReset}>{ChineseEnglishSize.DepartmentDrugInformationMaintclean ? ChineseEnglishSize.DepartmentDrugInformationMaintclean.descripts : '清屏'}</Button>
                                    <Button type="primary" onClick={this.saveMaintain}>{ChineseEnglishSize.DepartmentDrugInformationMaintsave ? ChineseEnglishSize.DepartmentDrugInformationMaintsave.descripts : '保存'}</Button>
                                </Row>
                            </Col>

                        </Card>
                    </Row>
                    <Row>
                        <Col>
                            <Card
                                size="small"
                                title={<div style={{ position: "relative" }}>
                                    <div className="card-title-left-icon">
                                        <div></div>
                                        {ChineseEnglishSize.DepartmentDrugInformationMaintdeptDrugInfoMainForm ? ChineseEnglishSize.DepartmentDrugInformationMaintdeptDrugInfoMainForm.descripts : '科室药品信息维护单'}
                                    </div>
                                    <div style={{ position: "absolute", right: "132px", top: "-6px", }}>
                                        最小可用在途数：<Input placeholder="请输入" style={{ width: "150px", marginRight: "15px" }} type="number" value={resAvaQty} onChange={this.handleResAvaQtyChange} />
                                        <Button style={{marginTop: "1px"}} type="primary" onClick={this.handleBatchUpdate}>批量更新</Button>
                                    </div>
                                </div>}
                            >
                                <div style={{ height: store.getState().tableHeight.y + 45 + 'px' }}>
                                    <Table
                                        columns={columns.length > 0 ? columns : this.columns}
                                        dataSource={this.state.WaListData}
                                        pagination={false}
                                        bordered
                                        style={{ height: store.getState().tableHeight.y - 45 + 'px' }}
                                        scroll={{ x: this.state.detailWidthTotal, y: store.getState().tableHeight.y - 85 }}
                                        rowKey={record => record.key}
                                        className="detailsHeight"
                                    />
                                    <CommonPagination size='small' current={this.state.page} total={this.state.total} search='search'
                                        onShowSizeChange={this.onShowSizeChange.bind(this)} complete={true} dataSource={this.state.WaListData}
                                        loading={this.state.loading} onChange={this.onChange.bind(this)} />
                                </div>
                            </Card>
                        </Col>
                    </Row>
                    <ColumnAuthoritysModel
                        clientWidth='800px'
                        compontName='DepartmentDrugInformationMaint'
                        configType="C"
                        onRef={this.onColumnRef}
                        reloadData={this.getDetailTableColumns}
                    />
                    <PublicModalTable onClickRowPublic={this.onClickRowPublic} param={param} onRef={this.onRef} />
                </div>
            )
        }
    }
);
export default DrugMessageMaintain;